<template>
  <div class="icon-container" @mouseover="showTooltip" @mouseleave="hideTooltip">
    <i :class="iconClass"></i>
    <!-- v-if="isTooltipVisible" -->
    <div  class="tooltip">
        <ul class="tooltip-content">
          <li v-for="(item, index) in content" :key="index">{{ item.incompatibleDsc }}</li>
        </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: 'iconPoint',
  props: {
    iconClass: {
      type: String,
      required: true
    },
    content: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      isTooltipVisible: false,
      result: {
        0: {
          body: [],
          output: [],
          path: [],
          query: [{
            name: 'test',
            code: '111'
          }]
        },
        1: {
          body: [],
          output: [],
          path: [],
          query: [{
            name: 'test',
            code: '111'
          }]
        },


      }
    };
  },
  methods: {
    showTooltip() {
      this.isTooltipVisible = true;
    },
    hideTooltip() {
      this.isTooltipVisible = false;
    }
  }
}
</script>

<style scoped>
.icon-container {
  position: relative;
  display: inline-block;
}

.tooltip {
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-10%);
  border-radius: 5px; /* 设置圆角边框 */
  width: 200px;
  max-height: 150px;
  overflow-y: auto;
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 9999;
}

/* .tooltip-arrow {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 10px solid #ccc;
  margin-right: -1px; 
} */

.tooltip-content {
  padding: 5px;
  list-style-type: none; /* 移除默认的列表样式 */
  margin: 0;
  padding: 0;
  text-align: center; /* 文字内容居中展示 */
}
.tooltip-content li {
  padding: 5px 0; /* 每个列表项的内边距 */
  font-size: 12px; /* 设置字体大小为12px */
  line-height: 1.5; /* 设置行高 */
  word-wrap: break-word; /* 确保长单词换行 */
  white-space: pre-wrap; /* 保留空白符并换行 */
}
/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 5px; /* 设置滚动条宽度 */
}

::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 10px; /* 设置滚动条滑块的圆角 */
}

::-webkit-scrollbar-track {
  background-color: #f0f0f0;
}
</style>